import numpy as np
from PIL import Image

from matplotlib import pyplot as plt

# 设置中文
plt.rcParams['font.sans-serif'] = ['KaiTi']
plt.rcParams['axes.unicode_minus'] = False
x = ["MobileNet", "ResNet", "Inception", "DenseNet"]
# x = ["MobileNet", "ResNet", "Inception", "DenseNet", "集成模型"]
# plt.figure(figsize=(9,7))
y = [0.9855,0.9809,0.9734,0.9894]
# y = [0.9855,0.9809,0.9734,0.9894,0.9921]

plt.ylim([0.95,1])
# plt.savefig("./compare1.png", dpi=300, bbox_inches='tight')
# plt.show()
# plt.figure(1)
plt.bar(x, y,zorder=0)
plt.bar(["集成模型"],[0.9921],zorder=0,color="red")
plt.title("基础模型和集成模型性能对比图")
plt.ylim([0.95,1])
plt.savefig("./compare.png", dpi=300, bbox_inches='tight')
plt.show()
# img1 = Image.open("./compare1.png")
# img2 = Image.open("./compare.png").resize((1660,1251))
# Image.blend(img1, img2,0.618).show()